package experimentReport.servlet;

import jakarta.servlet.http.*;

import java.io.*;
import java.util.regex.*;

public class SevenOne extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        Pattern pt = Pattern.compile("-?[0-9]+(\\.[0-9]+)?");
        Matcher mt = pt.matcher(req.getParameter("numbers"));
        String[] number={"整数:","分数:"};
        while(mt.find()){
            String s=mt.group();
            int i= s.contains(".") ? 1 : 0;
            number[i]=number[i]+s+" ";
        }
        resp.setContentType("text/html;charset=utf-8");
        resp.getWriter().write(number[0]+"<br>"+number[1]);
    }
}